# 1D Hermite程序
import numpy as np
class Mesh:
    def __init__(self, n: int, interval: list = [0, 1]):
        """n为剖分设置
            interval为区间
        Args:
            n (int): _description_
        """
        mesh = np.linspace(interval[0], interval[1], n+1)
        self.mesh = mesh[:]
        self.h = (interval[1] - interval[0]) / n  # 步长
        self.n = n  # 网格剖分
        self.n_nodes = n + 1  # 节点数
        
        # 初始化刚度矩阵 和 载荷向量
        self.K = np.zeros((self.n_nodes * 2, self.n_nodes * 2))
    

class FE:
    def __init__(self, mesh: Mesh, order: int):
        """有限元空间

        Args:
            mesh (Mesh): 网格
            order (int): 有限元空间的阶数
        """
        self.mesh = mesh
        
    
    def assemble_matrix(self):
        """
        组装刚度矩阵
        """
        ...
        
    def assemble_vector(self):
        """
        组装载荷向量
        """
        ...


# test
if __name__ == "__main__":
    mesh = Mesh(8)
    print(mesh.h)